package com.example.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.Mapper.BillAccountDao;
import com.example.pojo.Belaidup;
import com.example.pojo.BillAccount;
import com.example.vo.PageBean;

@Service
public class BillAccountService {
	@Autowired
	private BillAccountDao billAccountDao;
	/**
	 * 分页主表查询
	 * @param begin
	 * @param end
	 * @return
	 */
	public PageBean billAccountAll(int begin,int end){
		List<BillAccount> billAccounts=this.billAccountDao.billAccountAll((begin-1)*1,end);
		for (BillAccount b : billAccounts) {
			b.setBillAccount_details(this.billAccountDao.account_detailsByNo(b.getBillAccountID()));
		}
		PageBean p=new PageBean();
		p.setPagedata(billAccounts);
		p.setPagenum(begin);
		p.setPagesize(end);
		p.setRowcount(this.billAccountDao.sumCount());
		return p;
	}
	/**
	 * 按编号查询供应商
	 * @param CustID
	 * @return
	 */
	public List<Belaidup> findBelaidupByno(String CustID){
		return this.billAccountDao.findBelaidupByno(CustID);
	}
}
